home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Deutsche Edition 1
/
Deutsche Edition 1.iso
/
amok
/
061-070
/
amok65
/
makecpicscreen
/
makecpic.mod
< prev
next >
Wrap
Text File
|
1993-11-04
|
8KB
|
216 lines
(* ------------------------------------------------------------------------
:Program. MakeCPic.mod
:Author. Steffen Köhler
:Address. Grüne Str.1 2880 Brake
:Phone. 04401/70164
:Copyright. FreeWare
:Language. Modula-2
:Translator. M2Amiga 3.32d
:History. v1.0 Steffen Köhler Dez-90
:Imports. IconSupport ([fbs] AMOK#5)
:Contents. Generiert fertigen Modul- Sourcetext aus CPic- Files
:Contents. zum Einbinden von CPics (gepackten IFF- Bildern) als
:Contents. fertigen Screen direkt in den Programmtext
:Contents. (Öffen des Screens mittels MakeCPicScreen)
------------------------------------------------------------------------ *)
MODULE MakeCPic;
FROM FileSystem IMPORT Lookup,Response,Close,ReadChar,WriteChar,File;
FROM Arguments IMPORT GetArg,NumArgs;
FROM Terminal IMPORT WriteString,WriteLn;
FROM Workbench IMPORT WBObjectType;
FROM Strings IMPORT Length,Insert;
FROM Conversions IMPORT ValToStr;
FROM SYSTEM IMPORT ADR;
FROM Intuition IMPORT Image;
FROM IconSupport IMPORT CreateIcon;
FROM Arts IMPORT wbStarted;
FROM AmokIcon IMPORT LImage,HImage;
VAR
Zeichen,
a,
b : CHAR;
String : ARRAY [0..6] OF CHAR;
Argumente : INTEGER;
Input,
Output : File;
Inputname,
Outputname,
Output1,
Output2 : ARRAY [0..78] OF CHAR;
Buffer1,
Buffer2 : CARDINAL;
Laenge,
Counter : INTEGER;
Error : BOOLEAN;
PROCEDURE WriteDateiString(VAR Datei:File; String: ARRAY OF CHAR);
VAR
Counter: INTEGER;
BEGIN
Counter:=0;
WHILE Counter<=Length(String)-1 DO
WriteChar(Datei,String[Counter]);
INC(Counter);
END;
END WriteDateiString;
BEGIN
Buffer1:=20000;
Buffer2:=20000;
Argumente:=NumArgs();
IF Argumente=1 THEN
GetArg(1,Inputname,Laenge);
Output1:=Inputname;
Output2:=Inputname;
Insert(Output1,Length(Output1),".mod");
Insert(Output2,Length(Output2),".def");
END;
IF (Argumente=2) AND (NOT wbStarted) THEN
GetArg(1,Inputname,Laenge);
GetArg(2,Outputname,Laenge);
Output1:=Outputname;
Output2:=Outputname;
Insert(Output1,Length(Output1),".mod");
Insert(Output2,Length(Output2),".def");
END;
IF (Argumente=1) OR ((Argumente=2)AND (NOT wbStarted)) THEN
Lookup(Input,Inputname,Buffer1,FALSE);
IF Input.res=done THEN
WriteString(Inputname);
WriteString(" : Konvertierung beginnt");
Lookup(Output,Output1,Buffer2,TRUE);
IF Output.res=done THEN
WriteDateiString(Output,"IMPLEMENTATION MODULE ");
WriteDateiString(Output,Inputname);
WriteDateiString(Output,";");
WriteDateiString(Output,CHR(10));
WriteDateiString(Output,CHR(10));
WriteDateiString(Output,"(* Generated with MakeCPic V1.0");
WriteDateiString(Output,CHR(10));
WriteDateiString(Output," © by Steffen Köhler -- Grüne Str. 1 2880 Brake TEL 04401/70164 *)");
WriteDateiString(Output,CHR(10));
WriteDateiString(Output,"FROM SYSTEM IMPORT INLINE;");
WriteDateiString(Output,CHR(10));
WriteDateiString(Output,CHR(10));
WriteDateiString(Output,"PROCEDURE Bild;");
WriteDateiString(Output,CHR(10));
WriteDateiString(Output,"(* $E- *)");
WriteDateiString(Output,CHR(10));
WriteDateiString(Output,CHR(10));
WriteDateiString(Output,"BEGIN");
WriteDateiString(Output,CHR(10));
WriteDateiString(Output,"INLINE(");
WriteDateiString(Output,CHR(10));
Counter:=0;
WHILE NOT Input.eof DO
ReadChar(Input,a);
IF Input.eof THEN
b:=CHAR(0);
ELSE
ReadChar(Input,b);
END;
ValToStr((256*ORD(a)+ORD(b)),FALSE,String,16,5,'0',Error);
WriteDateiString(Output,String);
WriteDateiString(Output,'H');
IF NOT Input.eof THEN
WriteDateiString(Output,',');
END;
INC(Counter);
IF Counter>7 THEN
Counter:=0;
WriteString (".");
WriteDateiString(Output,CHR(10));
END;
END;
WriteDateiString(Output,")");
WriteDateiString(Output,CHR(10));
WriteDateiString(Output,"END Bild;");
WriteDateiString(Output,CHR(10));
WriteDateiString(Output,CHR(10));
WriteDateiString(Output,"BEGIN");
WriteDateiString(Output,CHR(10));
WriteDateiString(Output,"END ");
WriteDateiString(Output,Inputname);
WriteDateiString(Output,".");
WriteDateiString(Output,CHR(10));
Close(Output);
WriteLn;
IF NOT CreateIcon(ADR(Output1),ADR(LImage),
ADR(HImage),TRUE,project,ADR(":c/MuchMore")) THEN
WriteString('Konnte leider kein ICON erstellen ¿?');
WriteLn;
END;
WriteString("Datei erzeugt: ");
WriteString(Output1);
WriteLn;
Lookup(Output,Output2,Buffer2,TRUE);
IF Output.res=done THEN
WriteDateiString(Output,"DEFINITION MODULE ");
WriteDateiString(Output,Inputname);
WriteDateiString(Output,";");
WriteDateiString(Output,CHR(10));
WriteDateiString(Output,CHR(10));
WriteDateiString(Output,"(* Generated with MakeCPic V1.0");
WriteDateiString(Output,CHR(10));
WriteDateiString(Output," © by Steffen Köhler -- Grüne Str. 1 2880 Brake TEL 04401/70164 *)");
WriteDateiString(Output,CHR(10));
WriteDateiString(Output,CHR(10));
WriteDateiString(Output,"PROCEDURE Bild;");
WriteDateiString(Output,CHR(10));
WriteDateiString(Output,CHR(10));
WriteDateiString(Output,"END ");
WriteDateiString(Output,Inputname);
WriteDateiString(Output,".");
WriteDateiString(Output,CHR(10));
Close(Output);
IF NOT CreateIcon(ADR(Output2),ADR(LImage),
ADR(HImage),TRUE,project,ADR(":c/MuchMore")) THEN
WriteString('Konnte leider kein ICON erstellen ¿?');
WriteLn;
END;
WriteString("Datei erzeugt: ");
WriteString(Output2);
WriteLn;
WriteString("Fertig...");
WriteLn;
ELSE
WriteString('Ausgabe2 ließ sich nicht öffnen');
WriteLn;
END;
ELSE
WriteString('Ausgabe1 ließ sich nicht öffnen');
WriteLn;
END;
ELSE
WriteString('Eingabedatei ließ sich nicht öffnen');
WriteLn;
Close(Input);
END;
ELSE
WriteString(' MakeCPic 1.0');
WriteLn;
WriteString(' Macht Inlines aus CPic- Files');
WriteLn;
WriteLn;
WriteString(' Aufruf : Über die Workbench durch Anklicken des TextIcons und Doppelklick');
WriteLn;
WriteString(' auf das Bild- Icon oder');
WriteLn;
WriteString(' im CLI durch " MakeCPic Quelldatei <Zieldatei>"');
WriteLn;
WriteString(' wobei die Zieldatei, wenn nicht angegeben, auf Quelle + .mod bzw. .def');
WriteLn;
WriteString(' eingestellt ist.');
WriteLn;
END;
END MakeCPic.